﻿#include "xcoil_p.h"

XCoilPrivate::XCoilPrivate()
    : deviceType(PLC),
      deviceNumber(1),
      objectType(X),
      objectNumber(0)
{

}

XCoilPrivate::~XCoilPrivate()
{

}

XCoil::XCoil(QObject *parent)
    : QObject(parent),
      xCoilP(new XCoilPrivate)
{

}

XCoil::~XCoil()
{
    delete xCoilP;
}

/*!
    \property XCoil::deviceType
    \brief the type of the device

    The default deviceType is PLC.

    \sa indent
*/
DeviceType XCoil::getDeviceType() const
{
    return xCoilP->deviceType;
}

void XCoil::setDeviceType(DeviceType type)
{
    if(xCoilP->deviceType == type)
        return;
    xCoilP->deviceType = type;
}

/*!
    \property XCoil::deviceNumber
    \brief the number of the device

    The default deviceNumber is 1.

    \sa indent
*/
int XCoil::getDeviceNumber() const
{
    return xCoilP->deviceNumber;
}

void XCoil::setDeviceNumber(int num)
{
    if(xCoilP->deviceNumber == num)
        return;
    xCoilP->deviceNumber = num;
}

/*!
    \property XCoil::objectType
    \brief the type of the object

    The default objectType is X.

    \sa indent
*/
CoilObjectType XCoil::getObjectType() const
{
    return xCoilP->objectType;
}

void XCoil::setObjectType(CoilObjectType type)
{
    if(xCoilP->objectType == type)
        return;
    xCoilP->objectType = type;
}

/*!
    \property XCoil::objectNumber
    \brief the number of the object

    The default objectNumber is 0.

    \sa indent
*/
int XCoil::getObjectNumber() const
{
    return xCoilP->objectNumber;
}

void XCoil::setObjectNumber(int num)
{
    if(xCoilP->objectNumber == num)
        return;
    xCoilP->objectNumber = num;
}

/*!
    \property XCoil::coilValue
    \brief the value of the coil

    \sa indent
*/
bool XCoil::getCoilValue() const
{
    return xCoilP->coilValue;
}

void XCoil::setCoilValue(bool value)
{
    if(xCoilP->coilValue == value)
        return;
    xCoilP->coilValue = value;
}
